import Vue from 'vue'
import axios from 'axios';


// axios.defaults.headers.common['Authorization'] = JSON.parse(localStorage.getItem('token')).tokenHead + " " + JSON.parse(localStorage.getItem('token')).token;

axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.headers.get['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.transformRequest = [function (data) {
    let src = ''
    for (let item in data) {
        src += encodeURIComponent(item) + '=' + encodeURIComponent(data[item]) + '&'
    }
    return src
}]



axios.defaults.baseURL = "http://localhost:8080"            //开发配置
// axios.defaults.baseURL = "http://47.103.8.199:80/api"  //部署配置

Vue.prototype.$axios = axios








